<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateFilesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('files', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('md5', 64)->unique();
            $table->integer('users_id')->unsigned()->nullabel();
            $table->string('path', 255);
            $table->string('url', 255);
            $table->string('engine', 32);
            $table->string('file_name', 128);
            $table->bigInteger('size')->unsigned();
            $table->string('content_type')->nullabel();
            $table->string('extension', 32)->nullabel();
            $table->timestamps();
            $table->engine = 'MyISAM';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('files');
    }
}
